
JavaArt Chapter 8. A Compiler for Drawing Crop Circles

From the website:

  Killer Game Programming in Java
  http://fivedots.coe.psu.ac.th/~ad/jg

  Dr. Andrew Davison
  Dept. of Computer Engineering
  Prince of Songkla University
  Hat yai, Songkhla 90112, Thailand
  E-mail: ad@fivedots.coe.psu.ac.th


If you use this code, please mention my name, and include a link
to the website.

Thanks,
  Andrew

============================

This directory contains 9 Java programs.

  * CropCircles.java
         // top-level of compiler 
  * Lexer.java, Token.java
         // lexical analyzer
  * Parser.java, Nodes.java
         // syntax analyzer
  * Evaluator.java, RegPolygon.java, CCircle.java, GeometryUtils.java
         // evaluator


There is 1 manifest file for generating a JAR:
  * Manifest.txt

There are 1 subdirectory:
  * examples\     -- Crop text files for use in testing

There are 2 batch files:
  * CropBuild.bat
  * CropRun.bat
     - they assume that Apache Batik is in d:\batik-1.7\batik.jar
     - see below for installation details

----------------------------
Compilation:

> CropBuild *.java
     - because of the large number of class files generated, the classes are
       packed up in a JAR file (CropCircles.jar) by this batch file, and the 
       original class files are deleted.

----------------------------
Execution:

> CropRun <Crop textfile in examples/>
    - generates a SVG file in examples/ whose name ends ends with "Out.svg"

e.g.

> CropRun barburyCastle.txt
      - generates examples/barburyCastleOut.svg

> CropRun follyBarn.txt
      - generates examples/follyBarnOut.svg

> CropRun ivinghoe.txt
      - generates examples/ivinghoeOut.svg


----------------------------
Apache Batik Installation

Download the binary distribution of Apache Batik 1.7 (or later) from 
http://xmlgraphics.apache.org/batik/ (batik-1.7.zip; 12.5 MB), unzip it, 
and store in a convenient location (e.g.d:\batik-1.7\).

This location must match the paths used in the two batch files, 
CropBuild.bat and CropRun.bat

----------------------------
Viewing SVG files

A SVG file can be rendered by most browsers, or a SVG drawing application 
such as Inkscape (http://www.inkscape.org/?lang=en&css=css/base.css), 
or opened as a text file.

---------
Last updated: 9th August 2010
